home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / patches / patchlibv4 / include / patch.h < prev    next >
C/C++ Source or Header  |  1996-01-31  |  6KB  |  140 lines

  1. #ifndef LIBRARIES_PATCH_H
  2. #define LIBRARIES_PATCH_H
  3. /*****************************************************************************/
  4. /*
  5. **    Filename:    libraries/patch.h
  6. **    Release:    4.0
  7. **    Date:        31.01.96
  8. **
  9. **    definition of patch.library public structures and returncodes
  10. **
  11. **    (C) Copyright 1993-96 Stefan Fuchs
  12. **    All Rights Reserved
  13. */
  14. /*****************************************************************************/
  15.  
  16. #ifndef    EXEC_TYPES_H
  17. #include <exec/types.h>
  18. #endif
  19.  
  20. #ifndef    EXEC_LISTS_H
  21. #include    <exec/lists.h>
  22. #endif    /* EXEC_LISTS_H */
  23.  
  24. #ifndef    EXEC_LIBRARIES_H
  25. #include    <exec/libraries.h>
  26. #endif    /* EXEC_LIBRARIES_H */
  27.  
  28. #ifndef    EXEC_SEMAPHORES_H
  29. #include    <exec/semaphores.h>
  30. #endif    /* EXEC_SEMAPHORES_H */
  31.  
  32.  
  33. /*----------------------------------------------------------------------------*/
  34. /* Structure required to install new patches via patch.library/InstallPatch() */
  35.  
  36. struct NewPatch                /*this structure is OBSOLETE from V2 on */
  37. {
  38.     APTR    NPAT_NewCode;        /* pointer to the patch code to be installed */
  39.     ULONG    NPAT_NewCodeSize;    /* optional length of NPAT_NewCode in bytes  */
  40.     APTR    NPAT_LibraryName;    /* pointer to the LibraryName                */
  41.     UWORD    NPAT_LibVersion;    /* version of Library to open                */
  42.     WORD    NPAT_LVO;        /* LVO of function to patch                  */
  43.     WORD    NPAT_Priority;        /* Priority (-127...+126) of the patch       */
  44.     UWORD    NPAT_Flags;        /* currently none defined (keep zero)        */
  45.     APTR    NPAT_PatchName;        /* optional pointer to an IDString           */
  46.     APTR    NPAT_Result2;        /* optional pointer to longword for Result2  */
  47. };
  48.  
  49. /*----------------------------------------------------------------------------*/
  50.  
  51. /* ErrorCodes */
  52. #define PATERR_Ok        0    /* Everything Ok                */
  53. #define PATERR_PatchInUse    1    /* Patch Usecount <> 0                */
  54. #define PATERR_InvalidHandle    2    /* Pointer to patch is not (no longer) valid    */
  55. #define PATERR_OutOfMem        3    /* Out of memory                */
  56. #define PATERR_OpenLib        4    /* Failed to open requested library        */
  57. #define PATERR_FuncNotStd    5    /* Function to patch is not in the standard format */
  58. #define PATERR_PatchInstalled    6    /* Can't remove patch because another program has  */
  59.                     /* installed a non-patch.library patch later       */
  60. #define PATERR_InvalidTags    7    /* There was an error in the combination of the specified Tags */
  61. #define PATERR_OpenDev        8    /* Failed to open requested device */
  62. #define PATERR_NoTaskList    9    /* PATT_AddTask... or PATT_RemTask... was specified for a patch, */
  63.                     /* which had no PATT_CreateTaskList set */
  64. #define PATERR_TaskListExists    10    /* PATT_CreateTaskList was specified, but there already exists a TaskList */
  65. #define PATERR_InvalidTaskList    11    /* PATT_CreateTaskList was specified with a wrong parameter */
  66. #define PATERR_PatchUnnamed    12    /* PATT_PatchName with GetPatch was specified, for a patch without an IDString */
  67. #define PATERR_NoSemaphore    13    /* Could not allocate semaphore */
  68.  
  69.  
  70. /*----------------------------------------------------------------------------*/
  71. #define    PatchName "patch.library"
  72.  
  73. /*----------------------------------------------------------------------------*/
  74.  
  75.  
  76.  
  77.  
  78. /*------------------------------------------------------------------------------*/
  79. /*------------------------------------------------------------------------------*/
  80. /* The following structures are not needed by normal patch.library applications */
  81. /*------------------------------------------------------------------------------*/
  82. /*------------------------------------------------------------------------------*/
  83. struct PatchBase
  84. {
  85.     struct Library LibNode;
  86.     UBYTE PB_Flags;                    /* no public flags defined */
  87.     UBYTE PB_reserved1;
  88.     ULONG PB_private1;
  89.     struct SignalSemaphore    PB_Semaphore;        /* Semaphore to protect MasterPatchList */
  90.     struct List        PB_MasterPatchHeader;    /* Listheader Structure for MasterPatch */
  91.  
  92.     /* ... */
  93.  
  94. };
  95.  
  96. /*----------------------------------------------------------------------------*/
  97. /* Before accessing this structure, make sure MPS_Node.ln_Type is PS_TYPE_MASTER */
  98.  
  99. struct MasterPatch            /* This structure is READONLY */
  100. {
  101. struct    Node    MPS_Node;        /* ln_Name may contain a pointer to the name of the patched library */
  102.                     /* To compensate the loss of a valid librarybase */
  103.                     /* ln_Name is now (V4) guranteed to contain a valid name */
  104.                     /* This may however be a library, device or resource name */
  105.     UWORD    MPS_Flags;        /* no public flags defined */
  106. struct    MinList    MPS_PatchHeader;    /* Listheader Structure for Patch structures */
  107.     APTR    MPS_Private01;        /* This pointer, up to V3 known as MPS_PatchedLibraryBase */
  108.                     /* has been renamed, because with the introduction of the */
  109.                     /* PatchSupervisor it may or may not contain a valid */
  110.                     /* librarybase, it may even contain 0. */
  111.     UWORD    MPS_PatchedLVO;        /* Library Vektor Offset in patched library */
  112.  
  113.     /* ... */
  114.  
  115. };
  116.  
  117. /*----------------------------------------------------------------------------*/
  118. /* Before accessing this structure, make sure PS_Node.ln_Type is either PS_TYPE_USER or PS_TYPE_SYSTEM */
  119. /* Make sure your program can handle lists, that do not contain any nodes of */
  120. /* PS_TYPE_USER or PS_TYPE_SYSTEM */
  121.  
  122. struct    Patch            /* This structure is READONLY */
  123. {
  124. struct    Node    PS_Node;    /* ln_Name may contain a pointer to the name of the patch */
  125.     UWORD    PS_Flags;    /* no public flags defined */
  126.  
  127.     /* ... */
  128.  
  129. };
  130.  
  131. /*----------------------------------------------------------------------------*/
  132. /* public types for patch and masterpatch structures: */
  133. #define PS_TYPE_MASTER    1    /* node is MasterPatch structure */
  134. #define PS_TYPE_USER    2    /* node was installed by an Application using the library interface */
  135. #define PS_TYPE_SYSTEM    3    /* node was installed by the support program PatchSetFunc */
  136.  
  137.  
  138.  
  139. #endif    /* LIBRARIES_PATCH_H */
  140.